from sc_engine.apps import messages as msgs

SCRIPT_NAME = 'forced_data'

map_names = {
    1191: 'Chupung-Ryeong',
    1194: 'Harmony', 
    1201: 'Neo Harmony',
    1202: 'Sin Chupung-Ryeong',
}

player_names = {
    624: 'Casy',
    665: 'FrOzean',
    667: 'YellOW[ArnC]',
    670: 'IriS',
    741: 'Justin',
    902: 'Kal',
    921: 'FireFist',
    988: 'fOrGG',
}

player_aliases = {
    133: ['[NC]Yellow'],
    668: ['AnyTime', 'AnyTime[gm]'],
    670: ['IriS[gm]'],
    789: ['FBH'],
    794: ['InteR.Clam'],
    983: ['gogo'],
    902: ['Siz)Kal'],
    921: ['Sea.FireFist'],
    954: ['Ryan[Shield]'],
    1071: ['BeSt[Shield]'],
    1311: ['GeumChi'],
}

manual_links = [
    # Mislabed as set 1, should be 4
    ('4vQQsH-Hrtw', 1, 'ShinhanBankProleague0809', ['Round2', 'Week6', 'Day4'],
        2, 4, 4),
    # Mislabled as set 32, should be 3
    ('j3Zr2cMwgD0', 1, 'ShinhanBankProleague0809', ['Round2', 'Week1', 'Day2'],
        9, 8, 3),
    # Labled as "ace" for 5th game
    ('Rs0bf9ZbEK4', 1, 'ShinhanBankProleague0809', ['Round4', 'Week1', 'Day1'],
        3, 4, 5),
]

def run(bus):
    for id, name in map_names.items():
        msg = msgs.MapNameForced(id, name)
        bus.send(msg)

    for id, name in player_names.items():
        msg = msgs.PlayerNameForced(id, name)
        bus.send(msg)

    for id, aliases in player_aliases.items():
        for alias in aliases:
            msg = msgs.PlayerAliasForced(id, alias)
            bus.send(msg)

    # Do a data request to make sure new changes go into affect
    ids = set(player_names.keys())
    ids.update(player_aliases.keys())

    for id in ids:
        msg = msgs.PlayerDataRequested(id)
        bus.send(msg)

    for args in manual_links:
        msg = msgs.ManualProleagueYouTubeLinkAnnouncement(*args)
        bus.send(msg)

